package model;

import java.util.Date;

public class Goods {
    private int id;
    private String name;
    private String detail;
    private String image1;
    private String image2;
    private String image3;
    private int old_level;
    private int category_id;
    private int user_id;
    private int inventory;
    private float price;
    private boolean is_bargain;
    private Date create_time;
    private boolean is_removed;
    private Category category;
    private User user;

    @Override
    public String toString() {
        return "Goods [id=" + id + ", name=" + name + ", detail=" + detail +", image1=" + image1 +", image2=" + image2 +", image3=" + image3
                + ", old_level=" + old_level + ", category_id=" + category_id + ", user_id=" + user_id + ", inventory=" + inventory + ", price="
                + price + ", is_bargain=" + is_bargain + ", create_time=" + create_time +", is_removed=" + is_removed + "]";
    }
    public void setCategoryid(int typeid) {
        if(category==null) {
            category = new Category();
        }
        category.setId(typeid);
    }
    public void setCategoryname(String typename) {
        if(category==null) {
            category = new Category();
        }
        category.setName(typename);
    }
    public void setUseravatar(String avatar) {
        if(user==null) {
            user = new User();
        }
        user.setAvatar(avatar);
    }
    public void setUsernickname(String nickname) {
        if(user==null) {
            user = new User();
        }
        user.setNickname(nickname);
    }
    public int getId() {
        return id;
    }
    public void setId(int id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getDetail() {
        return detail;
    }
    public void setDetail(String detail) {
        this.detail = detail;
    }
    public String getImage1() {
        return image1;
    }
    public void setImage1(String image1) {
        this.image1 = image1;
    }
    public String getImage2() {
        return image2;
    }
    public void setImage2(String image2) {
        this.image2 = image2;
    }
    public String getImage3() {
        return image3;
    }
    public void setImage3(String image3) {
        this.image3 = image3;
    }
    public int getOld_level() {
        return old_level;
    }
    public void setOld_level(int old_level) {
        this.old_level = old_level;
    }
    public int getCategory_id() {
        return category_id;
    }
    public void setCategory_id(int category_id) {
        this.category_id = category_id;
    }
    public int getUser_id() {
        return user_id;
    }
    public void setUser_id(int user_id ) {
        this.user_id = user_id;
    }
    public int getInventory() {
        return inventory;
    }
    public void setInventory(int inventory) {
        this.inventory = inventory;
    }
    public float getPrice() {
        return price;
    }
    public void setPrice(float price) {
        this.price = price;
    }
    public Date getCreate_time() {
        return create_time;
    }
    public void setCreate_time(Date create_time) {
        this.create_time = create_time;
    }
    public boolean isIs_bargain() {
        return is_bargain;
    }
    public void setIs_bargain(boolean is_bargain) {
        this.is_bargain = is_bargain;
    }
    public boolean isIs_removed() { return is_removed; }
    public void setIs_removed(boolean is_removed) { this.is_removed = is_removed; }
    public Category getcategory(){return category;}
    public void setcategory(Category category){this.category = category;}
    public User getuser(){return user;}
    public void setuser(User user){this.user = user;}
    public Goods() {
        super();
    }
    public Goods(int id, String name, String detail, String image1, String image2, String image3, int old_level, int category_id, int user_id,
                 int inventory,float price, Date create_time, boolean is_removed) {
        super();
        this.id = id;
        this.name = name;
        this.detail = detail;
        this.image1 = image1;
        this.image2 = image2;
        this.image3 = image3;
        this.old_level = old_level;
        this.category_id = category_id;
        this.user_id = user_id;
        this.inventory = inventory;
        this.price = price;
        this.is_bargain = false;
        this.create_time = create_time;
        this.is_removed = is_removed;
    }
}
